package com.boo.service;

import org.apache.http.entity.StringEntity;
import org.json.JSONObject;

import android.app.Activity;
import android.util.Log;

import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.JsonHttpResponseHandler;

/**
 * Login service - authentication service
 * 
 * @author ThuanHM <thuanhm@vnext.vn>
 * @since 2013/12/27
 * */
public class SendDataService extends BaseService {

	public SendDataService(Activity activity) {
		super(activity);
	}

	/**
	 * Execute login action
	 * 
	 * @author ThuanHM <thuanhm@vnext.vn>
	 * @since 2013/12/27
	 * 
	 * @param <String>
	 *            email - email string
	 * @param <String>
	 *            password - password string
	 * */
	
	public void getData(String url ,JSONObject jsonParams,JsonHttpResponseHandler callBack){
		try {
			StringEntity entity = new StringEntity(jsonParams.toString());
			this.post(url, entity, callBack);
		}
		catch (Exception e) {
			// TODO: handle exception
		}
	}
	
	
	public void getData(String url ,JsonHttpResponseHandler callBack){
		try {
			this.post(url,callBack);
		}
		catch (Exception e) {
			// TODO: handle exception
		}
	}
	
	public void sendData(String url ,JSONObject jsonParams,JsonHttpResponseHandler callBack){
		try {
			StringEntity entity = new StringEntity(jsonParams.toString());
			this.post(url, entity, callBack);
		}
		catch (Exception e) {
			Log.d("ThuanHM", "error send data is " + e.getMessage());
			// TODO: handle exception
		}
	}
	

	public void sendData(String url ,JSONObject jsonParams,AsyncHttpResponseHandler callBack){
		try {
			StringEntity entity = new StringEntity(jsonParams.toString());
			this.post(url, entity, callBack);
		}
		catch (Exception e) {
			Log.d("ThuanHM", "error send data is " + e.getMessage());
			// TODO: handle exception
		}
	}

	
}